﻿using Sage.DownloadLite.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sage.DownloadLite.Models
{
    /// <summary>
    /// 单文件下载进度信息
    /// </summary>
    public class SingleDownloadProgress
    {
        /// <summary>
        /// 任务信息
        /// </summary>
        public TaskInfo Task { get; set; } = new();
        /// <summary>
        /// 已下载字节数
        /// </summary>
        public long DownloadedBytes { get; set; }
        /// <summary>
        /// 总字节数
        /// </summary>
        public long TotalBytes { get; set; }
        /// <summary>
        /// 下载百分比
        /// </summary>
        public double Percentage { get; set; }
        /// <summary>
        /// 下载速度（字节/秒）
        /// </summary>
        public double Speed { get; set; }
        /// <summary>
        /// 格式化的已下载大小
        /// </summary>
        public string FormattedDownloaded => BytesFormatter.Format(DownloadedBytes);
        /// <summary>
        /// 格式化的总大小
        /// </summary>
        public string FormattedTotal => BytesFormatter.Format(TotalBytes);
        /// <summary>
        /// 格式化的下载速度
        /// </summary>
        public string FormattedSpeed => BytesFormatter.FormatSpeed(Speed);
    }
}
